package geektime.spring.springbucks.waiter;

import geektime.spring.springbucks.waiter.message.Message;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

public class AnnotationStarterRefreshListener implements ApplicationListener<ContextRefreshedEvent> {
    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        ApplicationContext applicationContext = contextRefreshedEvent.getApplicationContext();
        // 注入
        Message barista = applicationContext.getBean(Message.class);
//        boolean hello = barista.newOrders().send(MessageBuilder.withPayload("hello").build());
//        System.out.println("发送消息结果："+hello);
    }
}
